package com.issac.controller;


import com.issac.common.R;
import com.issac.entity.User;
import com.issac.service.AccountService;
import com.issac.service.CaptchaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;

/**
 * @ClassName MyController
 * @Author zy
 * @Date 2021/10/22 17:44
 * @Description 对账户进行操作，登录注册。。。
 * @Version 1.0
 */
@RestController
public class AccountController {

    @Autowired
    private AccountService accountService;

    @Autowired
    private CaptchaService captchaService;

    // 注册
    @PostMapping("/register")
    public R register(@RequestBody User user){
        return accountService.register(user);
    }


    public static void main(String[] args) {
        System.out.println('a');
    }

    // 获取验证码图片
    @GetMapping("/captcha")
    public R getCaptcha() throws IOException {
        return captchaService.getCaptcha();
    }
}
